package com.potato369.cryptNacos.config;

import cn.hutool.core.util.StrUtil;
import com.baidu.aip.contentcensor.AipContentCensor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class BaiduAipConfig {

    private BaiduAPIProps baiduAPIProps;

    @Autowired
    public void setBaiduAPIProps(BaiduAPIProps baiduAPIProps) {
        this.baiduAPIProps = baiduAPIProps;
    }

    @Bean
    public AipContentCensor aipContentCensor() {
        return new AipContentCensor(
                StrUtil.trimToEmpty(this.baiduAPIProps.getAppId()),
                StrUtil.trimToEmpty(this.baiduAPIProps.getAk()),
                StrUtil.trimToEmpty(this.baiduAPIProps.getSk())
        );
    }
}
